import {
  exportUrl,
  downloadTemplateUrl,
} from '@/api/materialRequisition/mesRequisitionOrderScan'

import { exportExcel } from '@/utils/judge'

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t('common.export'),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    //auth: "auth:operlog:export", //权限字段
  },
  // {
  //   name: $i18n.t("common.add"),
  //   type: "primary",
  //   icon: "el-icon-circle-plus-outline",
  //   handleName: "add", //点击时返回的标识
  // },
  // {
  //   name: $i18n.t("common.delete"),
  //   type: "danger",
  //   icon: "el-icon-delete",
  //   handleName: "deleteBatch", //点击时返回的标识
  //   isMultiple: true, // isSingle 表示必须选择一项//isMultiple: true, // 表示必须多选
  // },
  // {
  //   name: $i18n.t("common.import"),
  //   type: "primary",
  //   icon: "el-icon-circle-plus-outline",
  //   handleName: "import", //点击时返回的标识
  // },
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.edit"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "edit", //点击时返回的标识
  },
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail", //点击时返回的标识
  },
  {
    name: $i18n.t("common.delete"),
    type: "danger",
    class: "row-btn-danger",
    handleName: "delete", //点击时返回的标识
  },
]
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    orderNo: {
      type: 'input',
      label: $i18n.t('mesRequisitionOrderScan.orderNo'),  // 单据编号
    },
    planCode: {
      type: 'input',
      label: $i18n.t('mesRequisitionOrderScan.planCode'),  // 生产订单编码
    },
    printCode: {
      type: 'input',
      label: $i18n.t('mesRequisitionOrderScan.printCode'),  // 打印码
    },
    materialName: {
      type: 'input',
      label: $i18n.t('mesRequisitionOrderScan.materialName'),  // 打印码
    },
    scanTime: {
      type: 'datetimerange',
      label: $i18n.t('mesRequisitionOrderScan.scanTime'),  // 扫描时间
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss",
        searchArrKey: ["scanTimeMin", "scanTimeMax"]
      },
    },
  },
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    orderNo: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.orderNo"),  // 单据编号
      layout: 12,
      required: true,
    },
    orderLine: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.orderLine"),  // 明细行号
      layout: 12,
      required: false,
    },
    orderType: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.orderType"),  // 单据类型
      layout: 12,
      required: false,
    },
    planCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.planCode"),  // 生产订单编码
      layout: 12,
      required: false,
    },
    warehouseCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.warehouseCode"),  // 仓库编码
      layout: 12,
      required: true,
    },
    warehouseName: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.warehouseName"),  // 仓库名称
      layout: 12,
      required: true,
    },
    materialCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.materialCode"),  // 物料编码
      layout: 12,
      required: false,
    },
    materialName: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.materialName"),  // 物料名称
      layout: 12,
      required: false,
    },
    amount: {
      type: "number",
      label: $i18n.t("mesRequisitionOrderScan.amount"),  // 数量
      layout: 12,
      required: true,
    },
    snControl: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.snControl"),  // SN控制--物料控制，Y(管理SN)/N(管理数量)
      layout: 12,
      required: true,
    },
    unit: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.unit"),  // 单位
      layout: 12,
      required: false,
    },
    unitCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.unitCode"),  // 计量单位编码
      layout: 12,
      required: true,
    },
    printCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.printCode"),  // 打印码
      layout: 12,
      required: true,
    },
    scanTime: {
      type: "datetime",
      label: $i18n.t("mesRequisitionOrderScan.scanTime"),  // 扫描时间
      layout: 12,
      required: true,
      attrs: {
        "valueFormat": "yyyy-MM-dd HH:mm:ss",
      },
    },
    specification: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.specification"),  // 规格
      layout: 12,
      required: false,
    },
    batchNo: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.batchNo"),  // 批次号
      layout: 12,
      required: false,
    },
    supplyCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.supplyCode"),  // 供应商编码
      layout: 12,
      required: false,
    },
    supplyName: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.supplyName"),  // 供应商名称
      layout: 12,
      required: false,
    },
    owner: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.owner"),  // 货主
      layout: 12,
      required: false,
    },
    validDate: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.validDate"),  // 有效期
      layout: 12,
      required: false,
    },
    factoryCode: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.factoryCode"),  // 工厂编码(租户编码)
      layout: 12,
      required: true,
    },
    remark: {
      type: "input",
      label: $i18n.t("mesRequisitionOrderScan.remark"),  // 备注
      layout: 12,
      required: false,
    },
  },
}
//导入数据
export const importFormDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    model: {
      type: "button",
      label: "",
      layout: 24,
      required: false,
      title: $i18n.t("common.downloadTemplate"), // 下载模板
      style: {
        color: '#1867c0',
        fontSize: '14px'
      },
      on: {
        click: () => {
          exportExcel(downloadTemplateUrl)
        }
      }
    },
    file: {
      type: "input",
      label: $i18n.t("common.chooseFile"),
      layout: 24,
      // required: true,

    },
  }
}

